﻿<UserControl x:Class="GamePlugin.Controls.PropertyList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             x:Name="PropertyListObject"
             d:DesignHeight="704" d:DesignWidth="721">
    <Grid Width="713" Height="705">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="225" />
            <ColumnDefinition Width="256" />
            <ColumnDefinition Width="232*" />
        </Grid.ColumnDefinitions>

        <TreeView Height="371" HorizontalAlignment="Left" Margin="12,28,0,0" Name="propertyTreeView" VerticalAlignment="Top" Width="207" 
                  ItemsSource="{Binding Children}" TreeViewItem.Selected="TreeView_Selected">
            <TreeView.ItemContainerStyle>
                <!-- This Style binds a TreeViewItem to a TreeItem. -->
                <Style TargetType="{x:Type TreeViewItem}">
                    <Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
                    <Setter Property="IsSelected" Value="{Binding IsSelected}" />
                    <Setter Property="FontWeight" Value="Normal" />
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="FontWeight" Value="Bold" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </TreeView.ItemContainerStyle>

            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource ="{Binding Children}">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Name, Mode=TwoWay}" VerticalAlignment="Center" />
                    </StackPanel>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>

        <ListBox Height="604" HorizontalAlignment="Left" Name="PropertyItemListBox" VerticalAlignment="Top" Width="207" Margin="30,27,0,0" ItemsSource="{Binding Children}" Grid.Column="1">
            <ListBox.ItemContainerStyle>
                <!-- This Style binds a TreeViewItem to a TreeItem. -->
                <Style TargetType="{x:Type ListBoxItem}">
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="FontWeight" Value="Bold" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ListBox.ItemContainerStyle>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <TreeView  Grid.Column="2" HorizontalAlignment="Left" Margin="17,27,0,124" Name="detailedTreeView" Width="215" 
                   ItemsSource="{Binding Children}">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource ="{Binding Children}">
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Content="{Binding Name}" IsChecked="{Binding IsChecked}"/>
                    </StackPanel>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
        <Button Content="修改數據" Grid.Column="2" Height="23" HorizontalAlignment="Left" Margin="17,608,0,0" Name="ModifyData" VerticalAlignment="Top" Width="75" Click="ModifyData_Click" />

        <ListBox Height="202" HorizontalAlignment="Left" Margin="12,429,0,0" Name="LengnedItemListBox" ItemsSource="{Binding Children}" VerticalAlignment="Top" Width="207" >
            <ListBox.ItemContainerStyle>
                <!-- This Style binds a TreeViewItem to a TreeItem. -->
                <Style TargetType="{x:Type ListBoxItem}">
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="FontWeight" Value="Bold" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ListBox.ItemContainerStyle>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
        <TextBox Height="23" HorizontalAlignment="Left" Margin="77,646,0,0" Name="LegendItemNameText" VerticalAlignment="Top" Width="142" />
        <Label Content="傳說物品" Height="28" HorizontalAlignment="Left" Margin="12,644,0,0" Name="label1" VerticalAlignment="Top" />
        <Button Content="添加" Height="23" HorizontalAlignment="Left" Margin="12,682,0,0" Name="AddButton" VerticalAlignment="Top" Width="75" Click="AddButton_Click" />
        <Button Content="刪除" Height="23" HorizontalAlignment="Right" Margin="0,682,34,0" Name="DeleteButton" VerticalAlignment="Top" Width="75" Click="DeleteButton_Click" />
        <Button Content="存儲" Grid.Column="1" Height="23" HorizontalAlignment="Left" Margin="30,646,0,0" Name="SaveButton" VerticalAlignment="Top" Width="75" Click="SaveButton_Click" />
        <Button Content="讀入" Grid.Column="1" Height="23" HorizontalAlignment="Right" Margin="0,646,49,0" Name="LoadButton" VerticalAlignment="Top" Width="75" Click="LoadButton_Click" />
    </Grid>
</UserControl>
